package org.korifey.ffbdd.samples.logic;

import java.util.Map;

public class Variable implements Expression {
	protected String name;

	public Variable(String name) {
		super();
		this.name = name;
	}

	@Override
	public boolean eval(Map<String, Boolean> env) {
		if (!env.containsKey(name)) throw new RuntimeException("Evaluation error, map doesn't contain variable '"+name+"'");
		return env.get(name);
	}
	
	public String toString() {
		return name;
	}
	
	
}
